import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
        path: "/",
        redirect: "/home",
    },
    {
        path: '/home',
        name: 'home',
        component: Home
    },
    {
        path: "/category",
        name: "category",
        component: () =>
            import ("../views/Category.vue")
    },
    {
        path: "/suprise",
        name: "suprise",
        component: () =>
            import ("../views/Supries.vue"),
        meta: {
            keepAlive: true
        }
    },
    {
        path: "/cart",
        name: "cart",
        component: () =>
            import ("../views/Cart.vue"),
        meta: { //自定义路由标识数据
            login: true
        }
    },
    {
        path: "/my",
        name: "my",
        component: () =>
            import ("../views/My.vue")
    }

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router